import pandas as pd
import numpy as np

# 2.

def chang(data_,str_):
    for i in range(0,len(data_)):
        data_[i] = data_[i].strip(str_)
        data_[i] = float(data_[i])

#  3.

def add_(data_):
    for i in range(0,len(data_)):
        if data_.loc[i,'户型']!='暂无':
            data_one = data_.loc[i,'户型'].replace('室','/')
            data_one = data_one.replace('厅','/')
            data_one = data_one.replace('卫','/')
            data_one = data_one.split('/')
            data_.loc[i,'室'] = str(data_one[0])
            data_.loc[i,'厅'] = str(data_one[1])
            data_.loc[i,'卫'] = str(data_one[2])
        else:
            data_.loc[i,'室'] = '暂无'
            data_.loc[i,'厅'] = '暂无'
            data_.loc[i,'卫'] = '暂无'

# 4.

def print_all(data_,str_):
    print('max', data_[str_].max())
    print('std', data_[str_].std())
    print('mean', data_[str_].mean())
    print(data_[str_].describe())

# 5、6

def pops(data_,str_):
    ans = dict()
    for i in range(0,len(data_)):
        temp = data_.loc[i,str_]
        if temp not in ans:
            ans[temp] = 1
        else:
            ans[temp] += 1
    return ans